package hfjava;

import java.util.Scanner;

public class Visitor_1 {
    String name;
    int age;

    public int buy(){
        if (age<10||age>60){
            return 0;
        }else {
            return 35;
        }
    }

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        Visitor_1 lisan=new Visitor_1();
        String of=null;
        for (;;){
            System.out.println("请输入姓名：");
            lisan.name=input.next();
            System.out.println("请输入年龄：");
            lisan.age=input.nextInt();
            int price=lisan.buy();
            System.out.println(lisan.name+"的年龄是"+lisan.age+(price==0?"门票免费":"门票价格为"+price+"元"));
            System.out.println("继续购票码（y(是)N(否)）");
            of=input.next();
            if ("N".equals(of)){
                System.out.println("退出程序");
                break;

            }
        }
    }
}
